<template>
	<view class="details-page _box">
		<view class="top-con">
			<view class="top">
				总收入：{{totalIncome}}
			</view>
			<view class="top">
				总提现：{{totalWithdraw}}
			</view>
		</view>
		<scroll-view scroll-y="true" show-scrollbar="true" scroll-top="0">
			<view class="item" v-for="(item,index) in list" :key="index" v-if="!isshow">
				<!-- 银行信息 -->
				<view class="item-left">
					<text class="item-left-top">{{item.remarks}}</text>
					<text class="item-left-bottom">{{item.addTime}}</text>
				</view>

				<!-- 解绑按钮 -->
				<view class="item-right jia" v-if="item.addType==1">
					+{{ item.moneyNum }}
				</view>
				<view class="item-right jian" v-if="item.addType==-1">
					-{{ item.moneyNum }}
					<view class="state" v-if="item.fundsType=='WITHDRAW'">
						<text v-if="item.withdrawalStatus==0" style="color: #ccc;">审核中</text>
						<text v-if="item.withdrawalStatus==1" style="color: #ccc;">审核中</text>
						<text v-if="item.withdrawalStatus==2" style="color: #ccc;">提现失败</text>
						<text v-if="item.withdrawalStatus==3" style="color: #ccc;">提现成功</text>
					</view>
				</view>
			</view>
			<view class="no-content" v-if="isshow">
				<image src="../../static/images/no_order.png" mode="" class="no-img"></image>
				<view class="no-text">暂无内容...</view>
			</view>
		</scroll-view>
	</view>
</template>

<script>
	import {moneylist,moneygetSum} from '@/api/index.js'
	var i = 1
	export default {
		data() {
			return {
				list: [],
				jiannum:0,
				jianum: 0,
				totalIncome: 0,
				totalWithdraw: 0,
				isshow: true,
				pageNumber: 1,
				pageSize: 10
			}
		},
		onLoad() {
			moneylist({type: 1}).then(res=>{
				console.log(res)
				if(res.length===0) {
					this.isshow = true
				}else {
					this.list = res
					this.isshow = false
				}
				
			})
			moneygetSum({type: 2}).then(res=>{
				console.log(res)
				if(res.totalIncome===null) {
					this.totalIncome = 0
				}else {
					this.totalIncome = res.totalIncome
				}
				if(res.totalWithdraw===null) {
					this.totalWithdraw = 0
				}else {
					this.totalWithdraw = res.totalWithdraw
				}
			})
		},
		onShow() {
			i=0
		},
		onReachBottom(){
			console.log('触底')
			i++
			console.log(i)
			moneylist({
				pageNumber: i,
				pageSize: 10,
				type: 1
				}).then(res=>{
				console.log(res)
				for(var a=0;a<res.length;a++) {
					this.list.push(res[a])
				}
			})
		}
	}
</script>

<style lang="scss">
	.top-con{height:80rpx;background: #fff;display: flex;flex-direction: row;line-height: 80rpx;font-size: 24rpx;color: #999999;}
	.top{padding:0 24rpx;}
	.details-page {
		width: 100%;
	}
	scroll-view{margin-top:20rpx;}
	.item {
		background-color: #FFFFFF;
		display: flex;
		flex-direction: row;
		justify-content: space-between;
		align-items: center;
		width: 100%;
		height: 140rpx;
		box-sizing: border-box;
		padding: 30rpx 26rpx;
		margin-bottom: 2rpx;
		
		border-bottom-style: solid;
		border-width: 2rpx;
		border-color: #F5F5F5;
	}

	.item-left {
		display: flex;
		flex-direction: column;
		align-items: flex-start;
	}

	.item-left-top {
		color: rgba(62, 62, 62, 1);
		font-size: 28rpx;
		font-family: PingFangSC-regular;
	}

	.item-left-bottom {
		margin-top: 10rpx;
		color: rgba(153, 153, 153, 1);
		font-size: 20rpx;
		font-family: PingFangSC-regular;
	}

	.item-right {
		font-size: 28rpx;
		font-weight: bold;
		position: relative;
	}

	.jia {
		color: rgba(255, 32, 59, 1);
	}

	.jian {
		color: rgba(3, 183, 106, 1);
	}
	.no-content {
		text-align: center;
		.no-img {
			width: 300rpx;
			height: 300rpx;
		}
	}
	.state {
		width: 100rpx;
		position: absolute;
		right: 2rpx;
		bottom: -30rpx;
		text-align: right;
		font-size: 20rpx;
	}
</style>
